package com.assessment.servermanager.controller;


import javax.servlet.http.HttpServletResponse;

import com.assessment.servermanager.commen.controller.BaseController;
import com.assessment.servermanager.commen.entity.AjaxResult;
import com.assessment.servermanager.commen.page.TableDataInfo;
import com.assessment.servermanager.entity.TbContract;
import com.assessment.servermanager.service.ITbContractService;
import lombok.extern.java.Log;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 【请填写功能名称】Controller
 * 
 * @author jiajia
 * @date 2023-08-28
 */
@RestController
@RequestMapping("/contract")
public class TbContractController extends BaseController
{
    @Autowired
    private ITbContractService tbContractService;

    /**
     * 查询【请填写功能名称】列表
     */
    @GetMapping("/list")
    public TableDataInfo list(TbContract tbContract)
    {

        List<TbContract> list = tbContractService.selectTbContractList(tbContract);
        return getDataTable(list);
    }

    /**
     * 导出【请填写功能名称】列表
     */
    @PostMapping("/export")
    public void export(HttpServletResponse response, TbContract tbContract)
    {
       /* List<TbContract> list = tbContractService.selectTbContractList(tbContract);
        ExcelUtil<TbContract> util = new ExcelUtil<TbContract>(TbContract.class);
        util.exportExcel(response, list, "【请填写功能名称】数据");*/
    }

    /**
     * 获取【请填写功能名称】详细信息
     */
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tbContractService.selectTbContractById(id));
    }

    /**
     * 新增【请填写功能名称】
     */
    @PostMapping
    public AjaxResult add(@RequestBody TbContract tbContract)
    {
        return toAjax(tbContractService.insertTbContract(tbContract));
    }

    /**
     * 修改【请填写功能名称】
     */
    @PutMapping
    public AjaxResult edit(@RequestBody TbContract tbContract)
    {
        return toAjax(tbContractService.updateTbContract(tbContract));
    }

    /**
     * 删除【请填写功能名称】
     */
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tbContractService.deleteTbContractByIds(ids));
    }
}
